package DataProcess;

import baseAPI.Database;
import javafx.scene.Parent;
import javafx.scene.layout.Pane;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;

public class MainPage {
    private static Database database;
    private static MediaView mediaView;
    private static Media media;
    private static MediaPlayer mediaPlayer;

    public static void bind(Parent mainPage, Database database){

    }

    public static void updateMainPage(Parent mainPage){
        mediaView =  (MediaView) mainPage.lookup("#mediaView");
        java.io.File file = new java.io.File("pic/mainPage.mp4");
        String url = file.toURI().toString();
        media = new Media(url);
        mediaPlayer = new MediaPlayer(media);
        mediaPlayer.setAutoPlay(true); //设置自动播放
        mediaView.setMediaPlayer(mediaPlayer);
    }

    public static void stopPlay(){
        mediaPlayer.stop();
        mediaPlayer.dispose();
    }
}
